﻿using System.Collections.Generic;
using System.Windows.Documents;
using EzDesk.DesktopClient.FunctionWindowModule.View;
using EzDesk.DesktopClient.FunctionWindowModule.ViewContract;
using EzDesk.DesktopClient.FunctionWindowModule.ViewModel;
using EzDesk.Modularity;
using EzDesk.Utility.Net;
using Microsoft.Practices.Unity;

namespace EzDesk.DesktopClient.FunctionWindowModule
{
    public class FunctionWindowModuleInfo : IModule
    {
        private FunctionWindowModuleController _controller;

        public IModule Initialize()
        {
            IMClientUnityContainer.Instance
                .RegisterType<IFunctionPageView, FunctionPageView>()
                .RegisterType<IFunctionPageViewModel, FunctionPageViewModel>()
                //.RegisterType<IFunctionPageViewModel, FunctionFormViewModel>()
                .RegisterType<IActionView, ActionView>()
                .RegisterType<IWebRequestExt, WebRequestExt>()
                .RegisterType<IActionViewModel, ActionViewModel>(new InjectionConstructor(
                        new ResolvedParameter(typeof(IWebRequestExt)),
                        DataManagement.Instance))
                .RegisterType<List<IFunctionPageViewModel>>(new InjectionMember[] { })
                .RegisterType<FunctionWindowModuleController>(
                    new InjectionConstructor(
                        new ResolvedParameter(typeof(IActionViewModel)),
                        new ResolvedArrayParameter<IFunctionPageViewModel>(),
                        UserManagement.Instance,IMClientUnityContainer.Instance));

            _controller = IMClientUnityContainer.Instance.Resolve<FunctionWindowModuleController>();
            return this;
        }
    }
}
